import Vue from 'vue'
import VueRouter from 'vue-router'
import Main from '../views/Main.vue'
import Home from "../components/Home.vue"
import Login from "../components/Login.vue"
import Register from "../components/Register.vue"
import Destination from "../components/Destination.vue"
import StrategyIndex from "../components/StrategyIndex.vue"
import StrategyDetail from "../components/StrategyDetail.vue"
import TravelIndex from "../components/TravelIndex.vue"
import TravelDetail from "../components/TravelDetail.vue"
import DestinationDetail from "../components/DestinationDetail.vue"


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'main',
    component: Main,
    redirect: "home",
    children: [
      {
        path: '/home',
        name: 'home',
        component: Home,
      },
      // 目的地
      {
        path: '/destination',
        name: "destination",
        component: Destination
      },
      // 目的地详情页
      {
        path: '/destinationDetail',
        name: "destinationDetail",
        component: DestinationDetail
      },
      // 旅游攻略
      {
        path: '/strategyIndex',
        name: "strategyIndex",
        component: StrategyIndex
      },
      // 旅游攻略详情页
      {
        path: '/strategyDetail',
        name: "strategyDetail",
        component: StrategyDetail
      },
      // 旅游日记
      {
        path: '/travelIndex',
        name: "travelIndex",
        component: TravelIndex
      },
      // 旅游日记详情页
      {
        path: '/travelDetail',
        name: "travelDetail",
        component: TravelDetail
      }
    ]
  },
  // 登录
  {
    path: "/login",
    name: 'login',
    component: Login
  },
  // 注册
  {
    path: "/register",
    name: "register",
    component: Register
  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
